package org.example;

public class Duration {
    private int _hour;
    private int _min;
    private int _sec;

    public Duration() {
    }

    public Duration(int _hour, int _sec, int _min) {
        this._hour = _hour;
        this._sec = _sec;
        this._min = _min;
    }

    public Duration(int seconds) {
        this._hour = seconds / 3600;
        seconds %= 3600;
        this._min = seconds / 60;
        seconds %= 60;
        this._sec = seconds;
    }

    public int getTotalSeconds()
    {
        return _hour * 3600 + _min * 60 + _sec;
    }

    public void disp()
    {
        System.out.println(_hour + "小时" + _min + "分钟" + _sec + "秒");
        System.out.println("总秒数: " + getTotalSeconds());
    }


    public void set_sec(int _sec) {
        this._sec = _sec;
    }

    public void set_min(int _min) {
        this._min = _min;
    }

    public void set_hour(int _hour) {
        this._hour = _hour;
    }

    public int get_hour() {
        return _hour;
    }

    public int get_min() {
        return _min;
    }

    public int get_sec() {
        return _sec;
    }
}
